package com.dorm.cj.design.demo;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1592424085687365442L;
    @javax.persistence.Transient
    protected Map<String, Object> extra = new HashMap<>();

    public BaseEntity(Map<String, Object> extra) {
        this.extra = extra;
    }

    public BaseEntity() {
    }

    @JsonAnyGetter
    public Map<String, Object> getExtra() {
        return extra;
    }

    @JsonAnySetter
    public void set(String key, Object value) {
        this.extra.put(key, value);
    }

    public Object get(String key) {
        return this.extra.get(key);
    }
}
